// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file adc_report.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace { char dummy; }
#endif

#include "adc_report.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>



adc_report::adc_report()
{
    // m_timestamp_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4abdb505
    m_timestamp_ = 0;
    // m_device_id_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@7ce6a65d
    m_device_id_ = 0;
    // m_channel_id com.eprosima.idl.parser.typecode.AliasTypeCode@1500955a
    memset(&m_channel_id, 0, (12) * 2);
    // m_raw_data com.eprosima.idl.parser.typecode.AliasTypeCode@e874448
    memset(&m_raw_data, 0, (12) * 4);
    // m_resolution_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@29b5cd00
    m_resolution_ = 0;
    // m_v_ref_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@60285225
    m_v_ref_ = 0.0;

}

adc_report::~adc_report()
{






}

adc_report::adc_report(const adc_report &x)
{
    m_timestamp_ = x.m_timestamp_;
    m_device_id_ = x.m_device_id_;
    m_channel_id = x.m_channel_id;
    m_raw_data = x.m_raw_data;
    m_resolution_ = x.m_resolution_;
    m_v_ref_ = x.m_v_ref_;
}

adc_report::adc_report(adc_report &&x)
{
    m_timestamp_ = x.m_timestamp_;
    m_device_id_ = x.m_device_id_;
    m_channel_id = std::move(x.m_channel_id);
    m_raw_data = std::move(x.m_raw_data);
    m_resolution_ = x.m_resolution_;
    m_v_ref_ = x.m_v_ref_;
}

adc_report& adc_report::operator=(const adc_report &x)
{

    m_timestamp_ = x.m_timestamp_;
    m_device_id_ = x.m_device_id_;
    m_channel_id = x.m_channel_id;
    m_raw_data = x.m_raw_data;
    m_resolution_ = x.m_resolution_;
    m_v_ref_ = x.m_v_ref_;

    return *this;
}

adc_report& adc_report::operator=(adc_report &&x)
{

    m_timestamp_ = x.m_timestamp_;
    m_device_id_ = x.m_device_id_;
    m_channel_id = std::move(x.m_channel_id);
    m_raw_data = std::move(x.m_raw_data);
    m_resolution_ = x.m_resolution_;
    m_v_ref_ = x.m_v_ref_;

    return *this;
}

size_t adc_report::getMaxCdrSerializedSize(size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += ((12) * 2) + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);


    current_alignment += ((12) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

size_t adc_report::getCdrSerializedSize(const adc_report& data, size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    if ((12) > 0)
    {
        current_alignment += ((12) * 2) + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);
    }

    if ((12) > 0)
    {
        current_alignment += ((12) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
    }

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

void adc_report::serialize(eprosima::fastcdr::Cdr &scdr) const
{

    scdr << m_timestamp_;
    scdr << m_device_id_;
    scdr << m_channel_id;

    scdr << m_raw_data;

    scdr << m_resolution_;
    scdr << m_v_ref_;
}

void adc_report::deserialize(eprosima::fastcdr::Cdr &dcdr)
{

    dcdr >> m_timestamp_;
    dcdr >> m_device_id_;
    dcdr >> m_channel_id;

    dcdr >> m_raw_data;

    dcdr >> m_resolution_;
    dcdr >> m_v_ref_;
}

/*!
 * @brief This function sets a value in member timestamp_
 * @param _timestamp_ New value for member timestamp_
 */
void adc_report::timestamp_(uint64_t _timestamp_)
{
m_timestamp_ = _timestamp_;
}

/*!
 * @brief This function returns the value of member timestamp_
 * @return Value of member timestamp_
 */
uint64_t adc_report::timestamp_() const
{
    return m_timestamp_;
}

/*!
 * @brief This function returns a reference to member timestamp_
 * @return Reference to member timestamp_
 */
uint64_t& adc_report::timestamp_()
{
    return m_timestamp_;
}

/*!
 * @brief This function sets a value in member device_id_
 * @param _device_id_ New value for member device_id_
 */
void adc_report::device_id_(uint32_t _device_id_)
{
m_device_id_ = _device_id_;
}

/*!
 * @brief This function returns the value of member device_id_
 * @return Value of member device_id_
 */
uint32_t adc_report::device_id_() const
{
    return m_device_id_;
}

/*!
 * @brief This function returns a reference to member device_id_
 * @return Reference to member device_id_
 */
uint32_t& adc_report::device_id_()
{
    return m_device_id_;
}

/*!
 * @brief This function copies the value in member channel_id
 * @param _channel_id New value to be copied in member channel_id
 */
void adc_report::channel_id(const adc_report__short_array_12 &_channel_id)
{
m_channel_id = _channel_id;
}

/*!
 * @brief This function moves the value in member channel_id
 * @param _channel_id New value to be moved in member channel_id
 */
void adc_report::channel_id(adc_report__short_array_12 &&_channel_id)
{
m_channel_id = std::move(_channel_id);
}

/*!
 * @brief This function returns a constant reference to member channel_id
 * @return Constant reference to member channel_id
 */
const adc_report__short_array_12& adc_report::channel_id() const
{
    return m_channel_id;
}

/*!
 * @brief This function returns a reference to member channel_id
 * @return Reference to member channel_id
 */
adc_report__short_array_12& adc_report::channel_id()
{
    return m_channel_id;
}
/*!
 * @brief This function copies the value in member raw_data
 * @param _raw_data New value to be copied in member raw_data
 */
void adc_report::raw_data(const adc_report__long_array_12 &_raw_data)
{
m_raw_data = _raw_data;
}

/*!
 * @brief This function moves the value in member raw_data
 * @param _raw_data New value to be moved in member raw_data
 */
void adc_report::raw_data(adc_report__long_array_12 &&_raw_data)
{
m_raw_data = std::move(_raw_data);
}

/*!
 * @brief This function returns a constant reference to member raw_data
 * @return Constant reference to member raw_data
 */
const adc_report__long_array_12& adc_report::raw_data() const
{
    return m_raw_data;
}

/*!
 * @brief This function returns a reference to member raw_data
 * @return Reference to member raw_data
 */
adc_report__long_array_12& adc_report::raw_data()
{
    return m_raw_data;
}
/*!
 * @brief This function sets a value in member resolution_
 * @param _resolution_ New value for member resolution_
 */
void adc_report::resolution_(uint32_t _resolution_)
{
m_resolution_ = _resolution_;
}

/*!
 * @brief This function returns the value of member resolution_
 * @return Value of member resolution_
 */
uint32_t adc_report::resolution_() const
{
    return m_resolution_;
}

/*!
 * @brief This function returns a reference to member resolution_
 * @return Reference to member resolution_
 */
uint32_t& adc_report::resolution_()
{
    return m_resolution_;
}

/*!
 * @brief This function sets a value in member v_ref_
 * @param _v_ref_ New value for member v_ref_
 */
void adc_report::v_ref_(float _v_ref_)
{
m_v_ref_ = _v_ref_;
}

/*!
 * @brief This function returns the value of member v_ref_
 * @return Value of member v_ref_
 */
float adc_report::v_ref_() const
{
    return m_v_ref_;
}

/*!
 * @brief This function returns a reference to member v_ref_
 * @return Reference to member v_ref_
 */
float& adc_report::v_ref_()
{
    return m_v_ref_;
}


size_t adc_report::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
    size_t current_align = current_alignment;









    return current_align;
}

bool adc_report::isKeyDefined()
{
   return false;
}

void adc_report::serializeKey(eprosima::fastcdr::Cdr &scdr) const
{
    (void) scdr;
     
     
     
     
     
     
}
